<template>
  <el-container class="login-div">
    <!-- login header -->
    <el-header class="div-login-header">
      <div class="div-login-header-left">
        <h1>
          <a href="#">
            <img src="../../public/logo.png" alt="" />
          </a>
        </h1>
      </div>
      <div class="div-login-header-right">
        <ul>
          <li>
            <el-button type="text">联系我们</el-button>
          </li>
          <li>
            <el-button type="text">隐私保护</el-button>
          </li>
          <li>
            <el-button type="text">留言反馈</el-button>
          </li>
          <li>
            <el-button type="text">帮助中心</el-button>
          </li>
        </ul>
      </div>
    </el-header>
    <!-- login page -->
    <el-main class="div-login">
      <div class="left"></div>
      <div class="right">
        <LoginComponent class="login-compoment" />
      </div>
    </el-main>
  </el-container>
</template>

<script lang="ts">
import { computed, defineComponent, ref } from "vue";
import LoginComponent from "@/components/Logincomponents.vue";
import { getFormattedTime } from "@/functions/general";
import store from "@/store";
// 导入ElMessageBox，单独引用

export default defineComponent({
  name: "home",
  components: {
    LoginComponent
    // MyForm
  },
  setup() {
    // 给内容不足以撑满浏览器可视高度的页面添加以下设置，通过动态（监测浏览器窗口变化）设置页面容器最低高度，也就是footer组件正常加载，只是footer的兄弟容器的高度变化了，自身的位置也会变化。
    // footer + head = 170px
    const minHeight = ref<number>(document.documentElement.clientHeight - 160);

    const isShowUserMessage = ref<boolean>(false);

    return {
      isShowUserMessage,
      minHeight,
      nowUserName: computed(() => store.state.username),
      nowDate: computed(() => getFormattedTime("nowtime"))
      // judge if now is login page
    };
  }
});
</script>

<style scoped>
.el-main {
  background: url("../../public/background.png") no-repeat;
  /* 铺满盒子 */
  background-size: cover;
  height: 100%;
  width: 100%;
}
</style>
<style>
/* --------------------------login header ---------------------*/
.div-login-header {
  display: flex;
  flex-wrap: nowrap;
  height: 60px;
  background: black;
}
.div-login-header-left {
  max-width: 60%;
}
.div-login-header-left h1 {
  margin: 0;
  padding: 0;
  width: 50%;
  height: 60px;
}
.div-login-header-right {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 143px;
  flex-wrap: wrap;
}
.div-login-header-right > ul > li {
  display: inline-block;
}
.div-login-header-right > ul > li > .el-button {
  font-size: 18px;
  padding: 0 20px;
  color: #ffffff;
}
.div-login-header-right > ul > li > .el-button :hover {
  padding-bottom: 2px;
  border-bottom: 2px solid #ffffff;
}
/* login header */

/*----------------- login-page--------------------- */
.div-login {
  display: flex;
}
.div-login .left {
  width: 1px;
  height: 1px;
}
.div-login .right {
  margin: 85px 125px 0 auto;
}
/* ------------------自定义element-plus样式------------------ */
.el-button {
  color: #ffffff;
}

.el-button {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
.el-input-number .el-input .el-input__inner {
  text-align: left;
}
</style>
